#!/bin/sh

set -eu

source /etc/rancher/desktop/credfwd

DATA="@-"
# The "list" command doesn't have a payload on STDIN
[ "$1" = "list" ] && DATA=""

# $CREDFWD_CURL_OPTS is intentionally *not* quoted
exec curl --silent --user "$CREDFWD_AUTH" --data "$DATA" --noproxy '*' --fail-with-body ${CREDFWD_CURL_OPTS:-} "$CREDFWD_URL/$1"
